import { Component, OnInit } from '@angular/core';
import {SinglePage} from "../../model/SinglePage";
import {SinglepageService} from "../../services/singlepage.service";

@Component({
  selector: 'app-singlepage',
  templateUrl: './singlepage.component.html',
  styleUrls: ['./singlepage.component.css']
})
export class SinglepageComponent implements OnInit {

   s1:Array<SinglePage>;
  constructor(private singlepageservice:SinglepageService) {
    this.s1=new Array<SinglePage>();
    this.initSinglePage();
  }
//只在项目运行时，执行一次
  ngOnInit(): void {
  }
  initSinglePage(){
    // let one=new SinglePage();
    // one.title="卡片1";
    // one.content="内容一";
    // one.picture="/assets/images/sp1.png";
    // this.s1.push(one);
    //
    // let two=new SinglePage();
    // two.title="卡片2";
    // two.content="内容二";
    // two.picture="/assets/images/sp2.png";
    // this.s1.push(two);
    //
    // let three=new SinglePage();
    // three.title="卡片3";
    // three.content="内容三";
    // three.picture="/assets/images/sp3.png";
    // this.s1.push(three);
  this.singlepageservice.getSinglePageList()
    .then((data:any)=>{
      this.s1=new Array();
      this.s1=data.list;

    })

  }

}
